;(function () { 
	var importPassword = {} 
	importPassword.install = function (Vue,options) { 
		Vue.directive('import', { 
			update: function (value) {
				
				this.callBack = value;				
				this.target = this.el;	//当前元素					
				var self = this;
				this.realInput = this.target.children[0];//获取隐藏的input
				this.bogusInput = this.target.children[1];
				this.shelter = this.target.children[2];
				this.bogusInputArr = this.bogusInput.children;//获取所有input
				this.maxLength = this.bogusInputArr[0].getAttribute("maxlength");//最大长度
				this.realInput.oninput = function(){ //设置值					
					self.setValue();
				};
							
			},
			setValue:function(){
								
				var This =this,real_str;
				This.realInput.value = This.realInput.value.replace(/\D/g,'');//只能输入数字
				real_str = This.realInput.value;
			
				for(var i =0 ;i<This.maxLength; i++){					
					This.bogusInputArr[i].value = real_str[i] ?  real_str[i] : ''//判断输入到那个值
				}
				
				//判断是否到达6个以上 截取 执行回调
				if(real_str.length >= This.maxLength){
					
					This.realInput.value = real_str.substring(0,6);
					This.callBack(this.getBoxInputValue());
				}								
			},
			getBoxInputValue:function(){
				var realValue = "";
				for(var  i in this.bogusInputArr){
					if(!this.bogusInputArr[i].value){
						break;
					}
					realValue += this.bogusInputArr[i].value;
				}
				return realValue;
			}
	
		});
	} 
	if (typeof exports == "object") {
		module.exports = importPassword;
	} else if (typeof define == "function" && define.amd) {
		define([], function(){ 
			return importPassword ;
		})
	} else if (window.Vue) { 
		window.importPassword = importPassword;
		Vue.use(vuePullLoading);
	}
})();
